package com.example.expandablelistview.fileio;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;

import com.example.expandablelistview.R;

public class EditPrefsActivity extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		getFragmentManager().beginTransaction()
        .replace(android.R.id.content, new EditPrefs())
        .commit();
	}
	
	public static class EditPrefs extends PreferenceFragment{
		@Override
		public void onCreate(Bundle savedInstanceState) {
			super.onCreate(savedInstanceState);
			addPreferencesFromResource(R.xml.editprefs);
			
			Preference p = findPreference("mobile");
	        p.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
	            @Override
	            public boolean onPreferenceClick(Preference arg0) {
	                Uri uri = Uri.parse("http://m.naver.com");
	                Intent browser = new Intent(Intent.ACTION_VIEW, uri);
	                startActivity(browser);
	                return false;
	            }
	        });
	        
		}
	}
}
